﻿using UnityEditor;
using UnityEngine;
using System.IO;

public class BuildAssetBundle
{
    public const string AssetBundlePath = "AssetBundle";

    [MenuItem("Neo/CreateAssetBundle/x86_x64")]
    static void CreateAssetBundle()
    {
        string path = Application.dataPath + "/" + AssetBundlePath + "/x86_x64";

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }

		BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows);
    }

	[MenuItem("Neo/CreateAssetBundle/x64")]
	static void CreateAssetBundle_x64()
	{
		string path = Application.dataPath + "/" + AssetBundlePath + "/x64";;        

		if (!Directory.Exists(path))
		{
			Directory.CreateDirectory(path);
		}

		BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
	}

	[MenuItem("Neo/CreateAssetBundle/MacOS")]
	static void CreateAssetBundle_MacOS()
	{
		string path = Application.dataPath + "/" + AssetBundlePath + "/OSX";;        

		if (!Directory.Exists(path))
		{
			Directory.CreateDirectory(path);
		}

		BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, BuildTarget.StandaloneOSX);
	}
}
